package app.action;

import java.awt.event.MouseEvent;
import java.rmi.RemoteException;

import javax.swing.event.MouseInputAdapter;

import remote.GameActionIfc;

public class MouseAction extends MouseInputAdapter {

	protected GameActionIfc gameAction;
	protected boolean scrolling = false;

	public MouseAction(GameActionIfc gameAction) {
		super();
		this.gameAction = gameAction;
	}

	@Override
	public void mousePressed(MouseEvent e) {
		try {
			gameAction.mousePressed(e);
		} catch (RemoteException e1) {
			e1.printStackTrace();
		}
	}

	@Override
	public void mouseDragged(MouseEvent e) {
		try {
			gameAction.mouseDragged(e);
		} catch (RemoteException e1) {
			e1.printStackTrace();
		}
	}

	@Override
	public void mouseClicked(MouseEvent e) {
		try {
			gameAction.mouseClicked(e);
		} catch (RemoteException e1) {
			e1.printStackTrace();
		}
	}

	@Override
	public void mouseMoved(MouseEvent e) {
		try {
			gameAction.mouseMoved(e);
		} catch (RemoteException e1) {
			e1.printStackTrace();
		}
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		try {
			gameAction.mouseReleased(e);
		} catch (RemoteException e1) {
			e1.printStackTrace();
		}
	}

	public boolean isScrolling() {
		return scrolling;
	}

	public void setScrolling(boolean scrolling) {
		this.scrolling = scrolling;
	}
}
